Module Level AttrDXL

Done some testing with Module level Attr-DXL and discovered some nuances. Put the following in an Attr DXL named "dxlModuleInfo" that applies to both Objects and the Module as type 'Text'.

// test module level attribute with Attr-DXL
/*    Put in a 'Text' attribute that applies to Module and Objects,
        as an Attr-DXL
*/
 
Buffer  buf     = create()
string  Name
AttrDef ad
 
int     iLevel = level(obj)
                //if (iLevel == 0) infoBox("start")
buf += "Identifier\t[" identifier(obj) "]\n"
buf += "Number    \t[" number(obj)     "]\n"
buf += "Level     \t[" level(obj)      "]\n"
 
if (iLevel == 0) obj."Object Text" = "Text"
                //if (iLevel == 0) infoBox("before loop")
for ad in (current Module) do
{  if (!ad.object)                    continue
   Name = ad.name
   if (Name == attrDXLName)             continue
                //      if (iLevel == 0) infoBox(Name)
   buf += Name "\t[" (obj.Name) "]\n"
}
                //if (iLevel == 0) infoBox("before Assign")
 
if (iLevel == 0) buf += "obj.AbsNo null: " (null obj."Absolute Number") "\n"
 
obj.attrDXLName = tempStringOf(buf)
delete(buf)


Then open a DXL window from the module and run the following to print the Module level value of the attribute.

 

Module mod = current
#include <utils/wipeattr.dxl>             // Refresh DXL Attrs
print mod."dxlModuleInfo" "\n"
 
Attr__ attr = mod."Object Text"
if (null attr) //
then print "mod.Object Text is null\n"
else print (mod."Object Text") "\n"


I have the following observations:
> the best way to determine if you attr-DXL is running at the module level is to get the level(obj) and see if its zero.
> Object level attributes that are also Module level will display the correct information using obj.Name, even when "obj" is really the module.
> identifier(obj), number(obj), and level(obj) all seem to work.
> identifier(obj) seems to suggest that the Absolute Number is zero.
> Object level attributes that are not also Module level attributes are not undefined, but rather are defaulted to have null values, specifically including obj."Absolute Number"
> I see you can SET an Object level attribute for the module, in this case "Object Text". I find that VERY curious. Not sure why you would want to do this, however.
> I can determine no method of getting an "Object" handle on the module level without useing module-level attr-DXL. o=object(0) doesn't work.
> Attr-DXL that searches other attributes must be sure NOT to extract the value of itself, otherwise you go into an infinite loop and DOORS crashes within a few seconds. "if (Name == attrDXLName) continue" resolved that unpleasant experience.
> One prevents constant re-calculation of Attr-DXL by setting null results to a space instead of null: obj.attrDXLName = " ".

I make the following conclusions.
> bullet proof Attr-DXL needs to handle running at the module level
> few attr-DXL should be defined for the module.
> Its easy to crash and burn DOORS in this way.
> It may be easy to accidentally perform recursive queries which will crash DOORS. One way to avoid that is to put <obj.attrDXLName = " "> at the top of any DXL that does anything tricky. Then, if you query it again at least it has a value.

Wonder what else there is to learn, such as what happens when you use Module Properties to query the value of a module-level attribute that is an Attr-DXL; perhaps that counts the number of objects in the module.

 

 

 

  • Louie


So far, the following looks like a reasonable standard start for AttrDXL:

 

 

 

if (null obj)                                           halt    // not Attr-DXL
if (level(obj) == 0)                                    halt    // Module level attr-DXL
        // v9.2.0.1 bug, cannot set AttrDXL values of a deleted object.  Fixed in v9.2.0.2
if (    isDeleted(obj)                          and
        length(doorsInfo(infoVersion)) >=7   and 
        (doorsInfo(infoVersion))[0:6] == "9.2.0.1")   halt

 


llandale - Wed Mar 23 14:22:42 EDT 2011